<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ajax-1</title>
</head>
<body>

 	<div id="show"></div>
 	<button id="tb">发送同步请求</button>
 	<script>
 		var show = document.getElementById("show");
 		var button = document.getElementById("tb");
 		
 		button.onclick = () =>{
			 let xhr = new XMLHttpRequest();
			 xhr.onreadystatechange = () =>{
				 if(xhr.readyState==4){
					 if(xhr.status==200){
						 show.innerHTML += xhr.responseText;
					 }else{
						 throw new Error(xhr.status+":"+xhr.statusText);
					 }
				 }
			 }

			 xhr.open("GET","inc.jsp",true);
			 xhr.send();
		 }
 	</script>
 	

</body>
</html>